<template>
    <app-layout>
	    <view class='nav dir-left-nowrap'>
	        <image class='nav-img' src='./../image/right-icon.png'></image>
	        <view>协议内容</view>
	    </view>
        <view class="padding">
            <app-rich-text class='text' :content="rules"></app-rich-text>
        </view>
    </app-layout>
</template>

<script>
    import { mapState } from "vuex";
    import appRichText from "../../../components/basic-component/app-rich/parse.vue";

    export default {
        data() {
            return {
        		rules: ' ',
            }
        },
        name: "rules",
        components: {
            "app-rich-text": appRichText,
        },
        computed: {
            ...mapState({
                theme: state => state.mallConfig.theme,
            })
        },
        methods: {
            getList(id) {
                let that = this;
                that.$showLoading({
                    text: '加载中...'
                });
                that.$request({
                    url: that.$api.vip_card.setting,
                }).then(response=>{
                    that.$hideLoading();
                    if(response.code === 0) {
            			that.loading = false;
                        uni.setNavigationBarTitle({
                            title: response.data.agreement_title?response.data.agreement_title: '超级会员卡使用说明'
                        });
                        that.rules = response.data.agreement_content;
                    }
                }).catch(e => {
                    that.$hideLoading();
                });
            },
        },
        onLoad() {
        	this.getList();
            uni.setStorage({
                key: 'vip_card_is_read',
                data: true,
                success: function () {
                    console.log('success');
                }
            });
        }
    }
</script>

<style scoped lang="scss">
	.nav {
	    font-size: #{32rpx};
	    color: #353535;
	    height: #{92rpx};
	    padding: #{40rpx} #{24rpx} #{4rpx};
        background-color: #fff;
	}

	.nav-img {
	    height: #{48rpx};
	    width: #{48rpx};
	    float: left;
	    display: block;
	    margin-right: #{24rpx};
	}

    .padding {
        padding: #{24rpx};
        background-color: #fff;
    }
</style>